package com.gdsdxy.controller;

import com.gdsdxy.dto.ResultVo;
import com.gdsdxy.entity.Follow;
import com.gdsdxy.service.IFollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/follow")
@Api(tags = "用户关注接口")
public class FollowController {
    @Resource
    IFollowService followService;

    @PutMapping("/{id}/{isFollow}")
    @ApiOperation(value = "关注功能", notes = "用户关注接口")
    public ResultVo follow(@PathVariable("id") Long followUserId,@PathVariable("isFollow") Boolean isFollow){
        return followService.follow(followUserId,isFollow);
    }

    @GetMapping("/or/not/{id}")
    @ApiOperation(value = "判断用户是否已经关注功能", notes = "判断用户是否已经关注接口")
    public ResultVo follow(@PathVariable("id")Long followUserId){
        return followService.isFollow(followUserId);
    }

    @GetMapping("/showFollow/{id}")
    @ApiOperation(value = "获取用户关注列表", notes = "获取用户关注列表接口")
    public List<Follow> selectFollow(@PathVariable("id") Long userId){return followService.selectFollow(userId);}

    @GetMapping("/showFans/{id}")
    @ApiOperation(value = "获取用户粉丝列表", notes = "获取用户粉丝列表接口")
    public List<Follow> selectFans(@PathVariable("id") Long followUserId){return followService.selectFans(followUserId);}
}
